package com.green.springsecuritydemo1;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

@SpringBootTest
public class MyTest1 {


    @Autowired
    private BCryptPasswordEncoder passwordEncoder;

    @Test
    public void test1(){
        String pwd = "123456";
        String encode = passwordEncoder.encode(pwd);
        System.out.println("密码为："+encode);

        boolean isTrue = passwordEncoder.matches(pwd, encode);
        System.out.println("密码是否正确："+isTrue);
    }
}
